***Last Updated: 12/14/2018 using Stata14
/*==========================================*
Paper:			Breaking the Cycle? Education and the Intergenerational Transmission of Violence

Purpose:        Produce the Simes adjusted p-values for the estimates generated by the 3a Tables.do

To re-run our analysis, please install a folder "Domestic Violence". There should be 5 subfolders in order for do-files to run:

"originals"
"created"
"do files"
"graphs"
"output"

Before you run this do file, please change the path of the working directory in line 24 and run all of the data cleaning do files.
*==========================================*/
clear
set more off 
set matsize 8000
cap log close
#delimit ;

global dir="XXX\Domestic Violence";
cd "$dir";

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**-------------------------
** APPENDIX TABLES---------
**-------------------------

*---------------------------------------------------------------------------------
********* TABLE A4: RD TREATMENT EFFECTS ON SCHOOLING (QUADRATIC CONTROL FUNCTION)
*---------------------------------------------------------------------------------
*quadratic RD, h bandwidth, with controls
foreach x in schooling jhighschool highschool primaryschool{

qui rdrobust `x' dif, bwselect(IK)
qui regress `x' after1986 di1 di2 $contr [aw=womenweight] if abs(dif)<85, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling pval_jhighschool pval_highschool pval_primaryschool

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta1_quadratic_rd_static.xls", replace

*quadratic RD, h bandwidth, with controls
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling jhighschool highschool primaryschool{

qui rdrobust `x' dif, bwselect(IK)
qui regress `x' after1986 di1 di2 $contr [aw=womenweight] if abs(dif)<e(h_bw), vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling pval_jhighschool pval_highschool pval_primaryschool

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta1_quadratic_rd_optimal.xls", replace


*--------------------------------------------------------------------------
********* TABLE A5: RD TREATMENT EFFECTS ON SCHOOLING (SAMPLE OF ALL WOMEN)
*--------------------------------------------------------------------------
 
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*linear RD, h bandwidth, with controls
foreach x in schooling jhighschool highschool primaryschool{

qui rdrobust `x' dif, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw), vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling pval_jhighschool pval_highschool pval_primaryschool

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta2_linear_rd_h.xls", replace

*linear RD, 0.75 h bandwidth, with controls
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling jhighschool highschool primaryschool{

qui rdrobust `x' dif, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw)*0.75, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling pval_jhighschool pval_highschool pval_primaryschool

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta2_rd_075h.xls", replace

*linear RD, 1.5 h bandwidth, with controls
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling jhighschool highschool primaryschool{

qui rdrobust `x' dif, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw)*1.5, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling pval_jhighschool pval_highschool pval_primaryschool

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta2_rd_15h.xls", replace

*---------------------------------------------------------------------------
********** TABLE A7: EDUCATION EFFECTS ON RELIGIOSITY
*---------------------------------------------------------------------------
use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_ols_full.xls", replace

*RD full sample, after1986
use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_rd_full.xls", replace

*IV full sample, schooling
use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_iv_full.xls", replace

use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_ols_rural.xls", replace

*RD rural sample, after1986
use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_rd_rural.xls", replace

*IV rural sample, schooling
use "created/TNSA2013_Analysis.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in fast headscarf namaz z_religious religious_course{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=weight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_fast pval_headscarf pval_namaz pval_z_religious pval_religious_course
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta4_iv_rural.xls", replace

*---------------------------------------------------------------------------
********** TABLE A8, PANEL A: EDUCATION EFFECTS ON VIOLENCE AGAINST CHILDREN
*---------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5a_iv_rural.xls", replace

*---------------------------------------------------------------------------
********** TABLE A8, PANEL B: EDUCATION EFFECTS ON VIOLENCE AGAINST CHILDREN
*---------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_full_schooling.xls", replace

*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta5b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A10, PANEL A: EDUCATION EFFECTS ON VIOLENCE AGAINST CHILDREN (OVERALL AND WITNESSED VIOLENCE)
*------------------------------------------------------------------------------------------------------------------------------------

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_full_schooling.xls", replace


*OLS full sample, schooling_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw)& has_children==1  , vce($se)
test schooling_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_full_schooling_others.xls", replace

*OLS full sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_full_violence_others.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_full_after1986.xls", replace

*RD full sample, after1986_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test after1986_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_full_after1986_others.xls", replace

*RD full sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_full_violence_others.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_full_schooling.xls", replace

*IV full sample, schooling_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test schooling_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_full_schooling_others.xls", replace

*IV full sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_full_violence_others.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_rural_schooling_others.xls", replace

*OLS rural sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_others violence_others $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_ols_rural_violence_others.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_rural_after1986.xls", replace

*RD rural sample, after1986_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test after1986_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_rural_after1986_others.xls", replace

*RD rural sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_others violence_others after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_rd_rural_violence_others.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_rural_schooling.xls", replace

*IV rural sample, schooling_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_rural_schooling_others.xls", replace

*IV rural sample, violence_others
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_others=after1986 after1986_others) violence_others di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test violence_others
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7a_iv_rural_violence_others.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A10, PANEL B: EDUCATION EFFECTS ON VIOLENCE AGAINST CHILDREN (OVERALL AND WITNESSED VIOLENCE)
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw)& has_children==1  , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_full_schooling.xls", replace


*OLS full sample, schooling_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw)& has_children==1  , vce($se)
test schooling_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_full_schooling_mother.xls", replace

*OLS full sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_full_mother_violence.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw)& has_children==1  , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_full_after1986.xls", replace

*RD full sample, after1986_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test after1986_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_full_after1986_mother.xls", replace

*RD full sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_full_mother_violence.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_full_schooling.xls", replace

*IV full sample, schooling_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test schooling_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_full_schooling_mother.xls", replace

*IV full sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_full_mother_violence.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_rural_schooling_mother.xls", replace

*OLS rural sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_mother mother_violence $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_ols_rural_mother_violence.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test after1986_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_rural_after1986_mother.xls", replace

*RD rural sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_mother mother_violence after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_rd_rural_mother_violence.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_mother
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test schooling_mother
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_rural_schooling_mother.xls", replace

*IV rural sample, mother_violence
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in hit_child hit_child_often{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_mother=after1986 after1986_mother) mother_violence di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & rural_pre12==1& has_children==1 , vce($se)
test mother_violence
gen pval_`x'=r(p)
}

keep pval_hit_child pval_hit_child_often
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta7b_iv_rural_mother_violence.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A12, PANEL A: EDUCATION EFFECTS ON ATTITUDES TOWARD VIOLENCE
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9a_iv_rural.xls", replace

*----------------------------------------------------------------------------------------------------------------------------
********** TABLE A12, PANEL B: EDUCATION EFFECTS ON ATTITUDES TOWARD VIOLENCE
*----------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_full_schooling.xls", replace


*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in agree_beat agree_childbeat{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_agree_beat pval_agree_childbeat
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta9b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A13, PANEL A: EDUCATION EFFECTS ON MATERNAL MENTAL HEALTH
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_depression z_somatic z_nonsomatic{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_depression pval_z_somatic pval_z_nonsomatic
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10a__iv_rural.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A13, PANEL B: EDUCATION EFFECTS ON MENTAL HEALTH
*------------------------------------------------------------------------------------------------------------------------------------

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_full_schooling.xls", replace

*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_somatic z_nonsomatic  z_depression{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_somatic pval_z_nonsomatic pval_z_depression
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta10b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A14, PANEL A: EDUCATION EFFECTS ON FERTILITY OUTCOMES
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw)  & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw)  & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw)  & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11a_iv_rural.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A14, PANEL B: EDUCATION EFFECTS ON FERTILITY OUTCOMES
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_full_schooling.xls", replace


*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif , bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) , vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in pregnancy_age num_children{

qui rdrobust `x' dif if  rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) &  rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_pregnancy_age pval_num_children
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta11b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A15, PANEL A: EDUCATION EFFECTS ON LABOR MARKET OUTCOMES
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in work_lastweek service social_security z_income z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_work_lastweek pval_service pval_social_security pval_z_income pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12a_iv_rural.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A15, PANEL B: EDUCATION EFFECTS ON LABOR MARKET OUTCOMES
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_full_schooling.xls", replace


*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_income work_lastweek service social_security z_asset{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_income pval_work_lastweek pval_service pval_social_security pval_z_asset
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta12b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A16, PANEL A: EDUCATION EFFECTS ON MARRIAGE MARKET OUTCOMES
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13a_iv_rural.xls", replace

*---------------------------------------------------------------------------------------------------------------------------------
********** TABLE A16, PANEL B: EDUCATION EFFECTS ON MARRIAGE MARKET OUTCOMES
*---------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_full_schooling.xls", replace


*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_full_violence_family.xls", replace


use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in schooling_partner husband_age z_malereligious marriage_age marriage_decision  divorced{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep  pval_schooling_partner pval_husband_age pval_z_malereligious pval_marriage_age pval_marriage_decision  pval_divorced
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta13b_iv_rural_violence_family.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A17, PANEL A: EDUCATION EFFECTS ON SPOUSAL VIOLENCE
*------------------------------------------------------------------------------------------------------------------------------------
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__ols_full.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__rd_full.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986) di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__iv_full.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__ols_rural.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__rd_rural.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling =after1986)  di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14a__iv_rural.xls", replace

*------------------------------------------------------------------------------------------------------------------------------------
********** TABLE A17, PANEL B: EDUCATION EFFECTS ON SPOUSAL VIOLENCE
*------------------------------------------------------------------------------------------------------------------------------------

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**FULL SAMPLE
*OLS full sample, schooling
foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial

keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_full_schooling.xls", replace


*OLS full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_full_schooling_family.xls", replace

*OLS full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_full_violence_family.xls", replace

*RD full sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_full_after1986.xls", replace

*RD full sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_full_after1986_family.xls", replace

*RD full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_full_violence_family.xls", replace

*IV full sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_full_schooling.xls", replace

*IV full sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_full_schooling_family.xls", replace

*IV full sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_full_violence_family.xls", replace

use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**RURAL SAMPLE
*OLS rural sample, schooling
foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_rural_schooling.xls", replace

*OLS rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_rural_schooling_family.xls", replace

*OLS rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' schooling schooling_family violence_family $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_ols_rural_violence_family.xls", replace

*RD rural sample, after1986
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"

global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_rural_after1986.xls", replace

*RD rural sample, after1986_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test after1986_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_rural_after1986_family.xls", replace

*RD rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui regress `x' after1986_family violence_family after1986 di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_rd_rural_violence_family.xls", replace

*IV rural sample, schooling
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_rural_schooling.xls", replace

*IV rural sample, schooling_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test schooling_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_rural_schooling_family.xls", replace

*IV rural sample, violence_family
use "created/women_data_for_analysis_2014.dta", clear
global contr="month_* noturkish2 region_pre12_* region_pre12i* rural_pre12"
global se "cluster modate"	
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

foreach x in z_physical z_emotional z_financial{

qui rdrobust `x' dif if has_children==1 & rural_pre12==1, bwselect(IK)
qui ivregress 2sls `x' (schooling schooling_family=after1986 after1986_family) violence_family di1* $contr [aw=womenweight] if abs(dif)<e(h_bw) & has_children==1 & rural_pre12==1, vce($se)
test violence_family
gen pval_`x'=r(p)
}

keep pval_z_physical pval_z_emotional pval_z_financial
keep if _n==1
xpose, clear varname
rename v1 p
rename _varname var
qqvalue p, method(simes) qvalue(p_simes)
outsheet var p_simes if var!="" using "output_simes/p_corr_ta14b_iv_rural_violence_family.xls", replace


